package com.lmx.healthcode.util;

import android.graphics.Color;

import com.wangpeiyuan.zxingbarcode.core.EncodeListener;
import com.wangpeiyuan.zxingbarcode.core.ZxingBarCode;
import com.wangpeiyuan.zxingbarcode.core.core.QRCodeParams;

/**
 * @author Leung
 * @date 2020/9/13 11:52
 */
public class QrCodeUtil {

    public static void createQrCode(String content, int color, EncodeListener listener) {
        QRCodeParams params = new QRCodeParams();
        params.setContent(content);
        params.setWidth(CommonUtil.dp2px(256));
        params.setHeight(CommonUtil.dp2px(256));
        params.setMargin(0);
        params.setBgColor(Color.TRANSPARENT);
        params.setPreColor(color);
        ZxingBarCode.encodeQRCode(params, listener);
    }

}
